package com.zj.whichone.constant;
/**
 * 用户权限
 * @author zj20160705
 *
 */
public enum UserRoot {
	admin(1,"管理员"),
	simple(2,"普通角色"),
	SUPER(3,"超级管理员"),
	common(4,"普通会员"),
	test(7,"普通玩家");
	private final int value;
	private final String phrase;
	private UserRoot(int value,String phrase){
		this.value = value;
		this.phrase = phrase;
	}
	public static String getPhrase(int value){
		for(UserRoot ur : values()){
			if(ur.value == value){
				return ur.phrase;
			}
		}
		return "没有权限值为"+value+"的权限!";
	}
	public static int getValue(String phrase){
		for(UserRoot ur : values()){
			if(ur.phrase.equals(phrase)){
				return ur.value;
			}
		}
		System.out.println("没有权限名称为"+phrase+"的权限!");
		return 7;
	}
}
